package com.ontheroad.mysql.topic.service;

import cn.modoumama.service.base.impl.BaseServiceImpl;
import com.ontheroad.mysql.topic.mapper.TopicMapper;
import com.ontheroad.topic.model.TopicModel;
import com.ontheroad.topic.service.TopicService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by kedong on 2017/10/12 0012.
 */
@Service
@Transactional
public class TopicServiceImpl extends BaseServiceImpl<TopicModel, Integer> implements TopicService {

    private Logger log = LoggerFactory.getLogger(getClass());

    @Autowired
    private TopicMapper mapper;

    @Autowired
    public void setMapper(TopicMapper mapper) {
        setGenericMapper(mapper);
    }


    @Override
    public TopicModel save(TopicModel topicModel) {
        mapper.insertModel(topicModel);
        return topicModel;
    }

    @Override
    public void updateHotByIds(Integer hotId) {
        mapper.updateHotByIds(hotId);
    }

    @Override
    public List<TopicModel> findByCircleId(Integer circleId) {
        return mapper.findByCircleId(circleId);
    }
}
